/* #include "/home/java/linux/jdk118/include/jni.h" */ #include "Arguments.h" #include JNIEXPORT jint JNICALL Java_Arg2_setArgs (JNIEnv *jenv, jobject job, jobjectArray oarr) { /* jint retval2 = (*jenv)->CallIntMethod( */ /* obtain the size the the array with a call to the JNI function GetArrayLength() */ jsize argc = (*jenv)->GetArrayLength(jenv, oarr); /* Declare a char array for argv */ char const* argv[128]; int i; for (i = 1; i < argc + 1; i++) { /* obtain the current object from the object array */ jobject myObject = (*jenv)->GetObjectArrayElement(jenv, oarr, i-1); /* Convert the object just obtained into a String */ const char *str = (*jenv)->GetStringUTFChars(jenv,myObject,0); /* Build the argv array */ argv[i] = str; /* print the argv array to the screen */ printf ("argv[%i] = %s\n",i,argv[i]); /* Free up memory to prevent memory leaks */ (*jenv)->ReleaseStringUTFChars(jenv, myObject, str); } /* Increment argc to ajust the difference between Java and C arguments argc++; Call a pipeline simulator function which uses command line arguments initializePipeline(argc,argv); */ return 2; }